<?php
defined('_JEXEC') or die('Restricted access');
//////////// Header module //////////////////////////////////////////////////////////////////////
$headermodule = 0;
if($this->countModules('header1')) $headermodule += 1;
if($this->countModules('header2')) $headermodule += 1;
if($this->countModules('header3')) $headermodule += 1;
if($this->countModules('header4')) $headermodule += 1;

switch ($headermodule) {
	case 1:
		$headermodulewidth = "width100";
		break;
	case 2:
		$headermodulewidth = "width50";
		break;
	case 3:
		$headermodulewidth = "width33";
		break;	
	case 4:
		$headermodulewidth = "width25";
		break;	
	default:
		$headermodulewidth = "";
}

$headermodsep1 = "";
$headermodsep2 = "";
$headermodsep3 = "";

if ($this->countModules('header1') && ($this->countModules('header2') || $this->countModules('header3') || $this->countModules('header4'))) {
	$headermodsep1 = "separator_header";
}

if ($this->countModules('header2') && ($this->countModules('header3') || $this->countModules('header4'))) {
	$headermodsep2 = "separator_header";
}

if ($this->countModules('header3') && ($this->countModules('header4'))) {
	$headermodsep3 = "separator_header";
}

////// Bottom module /////////////////////////////////////////////////////////////////////////////////////
$bottommodule = 0;
if($this->countModules('bottom1')) $bottommodule += 1;
if($this->countModules('bottom2')) $bottommodule += 1;
if($this->countModules('bottom3')) $bottommodule += 1;
if($this->countModules('bottom4')) $bottommodule += 1;

switch ($bottommodule) {
	case 1:
		$bottommodulewidth = "width100";
		break;
	case 2:
		$bottommodulewidth = "width50";
		break;
	case 3:
		$bottommodulewidth = "width33";
		break;	
	case 4:
		$bottommodulewidth = "width25";
		break;	
	default:
		$bottommodulewidth = "";
}

$bottommodsep1 = "";
$bottommodsep2 = "";
$bottommodsep3 = "";

if ($this->countModules('bottom1') && ($this->countModules('bottom2') || $this->countModules('bottom3') || $this->countModules('bottom4'))) {
	$bottommodsep1 = "separator_bottom";
}

if ($this->countModules('bottom2') && ($this->countModules('bottom3') || $this->countModules('bottom4'))) {
	$bottommodsep2 = "separator_bottom";
}

if ($this->countModules('bottom3') && ($this->countModules('bottom4'))) {
	$bottommodsep3 = "separator_bottom";
}


/////  Footer Modules  ////////////////////////////////////////////////////////////////////////////////////
$footermodule = 0;
if($this->countModules('footer1')) $footermodule += 1;
if($this->countModules('footer2')) $footermodule += 1;
if($this->countModules('footer3')) $footermodule += 1;
if($this->countModules('footer4')) $footermodule += 1;

switch ($footermodule) {
	case 1:
		$footermodulewidth = "width100";
		break;
	case 2:
		$footermodulewidth = "width50";
		break;
	case 3:
		$footermodulewidth = "width33";
		break;	
	case 4:
		$footermodulewidth = "width25";
		break;	
	default:
		$footermodulewidth = "";
}

$footermodsep1 = "";
$footermodsep2 = "";
$footermodsep3 = "";

if ($this->countModules('footer1') && ($this->countModules('footer2') || $this->countModules('footer3') || $this->countModules('footer4'))) {
	$footermodsep1 = "separator_footer";
}

if ($this->countModules('footer2') && ($this->countModules('footer3') || $this->countModules('footer4'))) {
	$footermodsep2 = "separator_footer";
}

if ($this->countModules('footer3') && ($this->countModules('footer4'))) {
	$footermodsep3 = "separator_footer";
}
///  INSET modules  //////////////////////////////////////////////////////////////////////////////////////////

$insetmodule = 0;
if($this->countModules('inset1')) $insetmodule += 1;
if($this->countModules('inset2')) $insetmodule += 1;

switch ($insetmodule) {
	case 1:
		$insetmodulewidth = "width100";
		break;
	case 2:
		$insetmodulewidth = "width50";
		break;
	default:
		$insetmodulewidth = "";
}

// Cookies
$cookie_prefix = "vt_special";
$cookie_time = time()+30000000;
$vtem_temp = array('TemplateStyle','Layout');

foreach ($vtem_temp as $tprop) {
    $vtem_session = &JFactory::getSession();
	
	if (isset($_REQUEST[$tprop])) {
	    $$tprop = JRequest::getString($tprop, null, 'get');
    	$vtem_session->set($cookie_prefix.$tprop, $$tprop);
    	setcookie ($cookie_prefix. $tprop, $$tprop, $cookie_time, '/', false);   
    	global $$tprop; 
    }
}
$template_baseurl				= $this->baseurl . '/templates/' . $this->template;

$Default_TemplateStyle 			= $this->params->get("TemplateStyle", "style1");
$Default_Layout			= $this->params->get("layout", "lbr");
$Font_Size						= $this->params->get("Font_Size", "12px");
$leftwidth     =    $this->params->get("leftwidth", "0");
$rightwidth     =    $this->params->get("rightwidth", "0");
$bodywidth     =    $this->params->get("bodywidth", "0");
$font  =    $this->params->get("font", "Arial, Helvetica, sans-serif");
switch ($font) {
	case 1:
		$font = 'Arial, Helvetica, sans-serif';
		break;
	case 2:
		$font = '"Times New Roman", Times, serif';
		break;
	case 3:
		$font = '"Courier New", Courier, monospace';
		break;	
	case 4:
		$font = 'Georgia, "Times New Roman", Times, serif';
		break;
	case 5:
		$font = 'Verdana, Arial, Helvetica, sans-serif';
		break;
    case 6:
		$font = 'Geneva, Arial, Helvetica, sans-serif';
		break;		
	default:
		$font = "Arial, Helvetica, sans-serif";
}
?>